﻿using System;

namespace suamod.core
{
    using SanlieHash;
    using SanlieHash.Fast;

    public class SuaPassword
    {
        public static string Get_2025A(string password)
        {
            var pin = SuaPin.Pin_2025A(password);
            var radom = SuaRadom.MakeNumberAndText(15);
            while (radom.EndsWith(pin.Substring(0, 3))) radom = SuaRadom.MakeNumberAndText(15);
            radom += pin.Substring(3);
            var pass = FastGuoMi.EncryptSM4(password, radom + FastHash.GetSha3_512(FastHash.GetMD5(password) + password));
            var passhash = FastHash.GetSha3_512(FastHash.GetMD5(pass) + pass);
            var a = FastHash.GetSha3_512(FastGuoMi.EncryptSM4(password, FastHash.GetSha3_512(FastHash.GetMD5(password) + password + FastHash.GetSha3_512(password))));
            return passhash + a+ radom;
        }
        public static string Get_2025A_PassForPin(string pass2025A)
        {
            return pass2025A.Substring(128, 128);
        }
        public static string Get_2025A_Random(string pass2025A)
        {
            return pass2025A.Substring(256);
        }
        public static string Get_2025A_RandomPass(string pass2025A)
        {
            return pass2025A.Substring(0, 128);
        }
    }
}
